<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
		<meta name="format-detection" content="telephone=no">
		<title>年会节目评选</title>
		<link rel="stylesheet" href="/templates/default/css/frozen.css">
		<link rel="stylesheet" href="/templates/default/css/style.css">
	</head>

<style>
	.list01{display: none}
</style>
	<body>

	<footer class="ui-footer ui-footer-btn">
		<ul class="ui-tiled ui-border-t">
			<li>
				<div>
					<a href="/home/index/articleVote3"><img src="/templates/default/images/btn2_01a.png" alt="评选投票"/></a>
				</div>
			</li>
			<li>
				<div>
					<a href="/home/index/vote_result"><img src="/templates/default/images/btn2_02.png" alt="投票记录"/></a>
				</div>
			</li>
		</ul>
	</footer>
		<section class="ui-container">
			<div class="head2">
				<img src="/templates/default/images/head6.jpg" alt="">
			</div>

			{{foreach from=$article_list item=i key=key}}
			<div class="roll roll_close">
				
				<div class="headbtn">
					<table width="100%" style="font-size: 14px;">
						<tr>
							<td rowspan="2" style="text-align: center;width: 22%;vertical-align: middle;">
								<div style="background: url(/templates/default/images/bg_07.png) no-repeat  center; background-size:contain;padding: 10px;    font-size: 16px;    font-weight: bold;    color: #db001a;">{{$key+1}}</div>
							</td>
							<td style="text-align: left;font-size: 14px;    color: #fff;">{{$i.article_title}}</td>
							<td rowspan="2" style="text-align: center;width: 10%;"><img style="    width: 111%;    margin-left: -30%;    vertical-align: middle;" src="/templates/default/images/bt_9.png" /></td>
						</tr>
						<tr>
							<td style="font-size: 14px;    color: #fff;">出场：{{$i.article2_count}}人</td>
						</tr>
					</table>
				</div>
				<div class="bigvote"><a onclick="vote('{{$i.article_id}}',1,'img_id_{{$i.article_id}}')"><img id="img_id_{{$i.article_id}}" src="/templates/default/images/{{if $i.is_vote==false }}big{{/if}}vote{{if $i.is_vote }}_cancel{{/if}}.png" alt=""></a></div>
			</div>
			{{/foreach}}

			
		</section>

		<script src="/templates/default/js/lib/zepto.min.js"></script>
		<script src="/templates/default/js/frozen.js"></script>
	<div class="ui-dialog" style="background:none;" id="ui-dialog_1">
		<div class="ui-dialog-cnt" style="
				width: 30%;
				background: rgba(0, 0, 0, 0.7);
				color: #fff;
				border-radius: 5px;
				padding: 15px 20px;
				text-align: center;
				">

			投票成功！

		</div>
	</div>

	<div class="ui-dialog" id="ui-dialog_2">
		<div class="ui-dialog-cnt" style="width:90%; background:none;">

			<img src="/templates/default/images/more3.jpg" style="width:100%;display: none;" id="more3_error">
			<img src="/templates/default/images/repeat.jpg" style="width:100%;display: none;" id="repeat_error">

			<div class="" style="
            position: absolute;
            top: 70%;
			height: 70px;
			display: block;
			width: 100%;
        ">
				<button type="button" data-role="button" style="width: 100%;color:rgba(0,0,0,0);border: none;border-radius: unset;height: 100%;" onclick="cancel('ui-dialog_2')">返回</button>
			</div>
		</div>
	</div>

<script class="demo-script">
	$(".headbtn").click(function() {
		var stat = $(this).parent().attr("class")
		if(stat.indexOf("roll_close") >= 0) {
			$(this).parent().removeClass("roll_close")
			$(this).parent().addClass("roll_open")
		} else {
			$(this).parent().removeClass("roll_open")
			$(this).parent().addClass("roll_close")
		}
	})

	$("#ui-dialog_1").click(function(){
		cancel('ui-dialog_1');
	})

	function vote(article_id,article_type,img_id){
		var url = '/home/index/vote';

		if($('#'+img_id).attr('src').indexOf('_cancel')>-1){//撤票
			url = '/home/index/cancelVote';
		}
		$.ajax({
			url: url,
			data: {
				article_id: article_id,
				article_type: article_type
			},
			type: 'POST',
			cache: false,
			dataType: 'html',
			success: function (data) {
				if(data==1){
					if(url=='/home/index/vote'){
						if(article_type==1){$('#'+img_id).attr('src','/templates/default/images/vote_cancel.png');}
						else{$('#'+img_id).attr('src','/templates/default/images/tou_cancel.png');}

						$("#ui-dialog_1").addClass("show");
						setTimeout("cancel('ui-dialog_1')",2000)
					}else{
						if(article_type==1){$('#'+img_id).attr('src','/templates/default/images/bigvote.png');}
						else{$('#'+img_id).attr('src','/templates/default/images/tou.png');}
					}
				}else if(data==0){
					alert('投票失败');
				}else if(data=='more3_error'){
					$('#more3_error').css('display','block');
					$('#repeat_error').css('display','none');
					$("#ui-dialog_2").addClass("show");
				}
				else if(data=='repeat_error'){
					$('#repeat_error').css('display','block');
					$('#more3_error').css('display','none');
					$("#ui-dialog_2").addClass("show");

					if(article_type==1){$('#'+img_id).attr('src','/templates/default/images/vote_cancel.png');}
					else{$('#'+img_id).attr('src','/templates/default/images/tou_cancel.png');}
				}
			},
			error: function () {
				//alert("AJAX异常！");
			}
		});
	}

	function cancel(dialog_id){
		$("#"+dialog_id).removeClass("show");
	}
</script>

	</body>

</html>